-- 在最开始添加职业判断
local _, playerClass = UnitClass("player")
if playerClass ~= "PALADIN" then
    -- 兼容中英文客户端
    return  -- 非圣骑士职业直接停止加载
end

print("haha-qs-cjq插件，版本：0.0.1.20250505")

local wowWatcher = CreateFrame("Frame", "BlueSquareFrame", UIParent);-- 创建一个新的框架
wowWatcher:SetFrameLevel(1);-- 设置框架的层级
wowWatcher:SetSize(42, 5) -- 宽度和高度都是100像素 -- 设置框架的尺寸
wowWatcher:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, 0) -- 距离屏幕左上角10,-10的位置 -- 设置框架的位置

local colorSize = 5;

-- 1-1 单目标输出开关，绿色为打开，红色为关闭
-- 1-2 智慧审判是否可以打，绿色为打，红色为不打
-- 1-3 愤怒之锤，绿色为打，红色为不打
-- 1-4 十字军打击，绿色为打，红色为不打
-- 1-5 神圣风暴，绿色为打，红色为不打
-- 1-6 奉献，绿色为打，红色为不打

-- 1-1 单目标输出开关，绿色为打开，红色为关闭
local one_target_switch_wl_green = wowWatcher:CreateTexture(nil, "BACKGROUND")
one_target_switch_wl_green:SetColorTexture(0, 1, 0, 1)
one_target_switch_wl_green:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 0, 0); -- 使纹理填充整个框架
one_target_switch_wl_green:SetSize(colorSize, colorSize);
one_target_switch_wl_green:SetAlpha(0);

local one_target_switch_wl_red = wowWatcher:CreateTexture(nil, "BACKGROUND")--创建纹理
one_target_switch_wl_red:SetColorTexture(1, 0, 0, 1)
one_target_switch_wl_red:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 0, 0);--设置框架相对锚点
one_target_switch_wl_red:SetSize(colorSize, colorSize)
one_target_switch_wl_red:SetAlpha(1)

-- 间隔纹理
local splitTexture1 = wowWatcher:CreateTexture(nil, "BACKGROUND")
splitTexture1:SetColorTexture(0.5, 0.5, 0.5, 1)
splitTexture1:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 5, 0); -- 使纹理填充整个框架
splitTexture1:SetSize(1, colorSize);
splitTexture1:SetAlpha(1);

-- 1-2 智慧审判是否可以打，绿色为打，红色为不打
local zhsp_wl_green = wowWatcher:CreateTexture(nil, "BACKGROUND")
zhsp_wl_green:SetColorTexture(0, 1, 0, 1)
zhsp_wl_green:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 6, 0); -- 使纹理填充整个框架
zhsp_wl_green:SetSize(colorSize, colorSize);
zhsp_wl_green:SetAlpha(0);

local zhsp_wl_red = wowWatcher:CreateTexture(nil, "BACKGROUND")--创建纹理
zhsp_wl_red:SetColorTexture(1, 0, 0, 1)
zhsp_wl_red:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 6, 0);--设置框架相对锚点
zhsp_wl_red:SetSize(colorSize, colorSize)
zhsp_wl_red:SetAlpha(1)

-- 间隔纹理
local splitTexture2 = wowWatcher:CreateTexture(nil, "BACKGROUND")
splitTexture2:SetColorTexture(0.5, 0.5, 0.5, 1)
splitTexture2:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 11, 0); -- 使纹理填充整个框架
splitTexture2:SetSize(1, colorSize);
splitTexture2:SetAlpha(1);

-- 1-3 愤怒之锤，绿色为打，红色为不打
local fnzc_wl_green = wowWatcher:CreateTexture(nil, "BACKGROUND")
fnzc_wl_green:SetColorTexture(0, 1, 0, 1)
fnzc_wl_green:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 12, 0); -- 使纹理填充整个框架
fnzc_wl_green:SetSize(colorSize, colorSize);
fnzc_wl_green:SetAlpha(0);

local fnzc_wl_red = wowWatcher:CreateTexture(nil, "BACKGROUND")--创建纹理
fnzc_wl_red:SetColorTexture(1, 0, 0, 1)
fnzc_wl_red:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 12, 0);--设置框架相对锚点
fnzc_wl_red:SetSize(colorSize, colorSize)
fnzc_wl_red:SetAlpha(1)

-- 间隔纹理
local splitTexture3 = wowWatcher:CreateTexture(nil, "BACKGROUND")
splitTexture3:SetColorTexture(0.5, 0.5, 0.5, 1)
splitTexture3:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 17, 0); -- 使纹理填充整个框架
splitTexture3:SetSize(1, colorSize);
splitTexture3:SetAlpha(1);

-- 1-4 十字军打击，绿色为打，红色为不打
local szjdj_wl_green = wowWatcher:CreateTexture(nil, "BACKGROUND")
szjdj_wl_green:SetColorTexture(0, 1, 0, 1)
szjdj_wl_green:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 18, 0); -- 使纹理填充整个框架
szjdj_wl_green:SetSize(colorSize, colorSize);
szjdj_wl_green:SetAlpha(0);

local szjdj_wl_red = wowWatcher:CreateTexture(nil, "BACKGROUND")--创建纹理
szjdj_wl_red:SetColorTexture(1, 0, 0, 1)
szjdj_wl_red:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 18, 0);--设置框架相对锚点
szjdj_wl_red:SetSize(colorSize, colorSize)
szjdj_wl_red:SetAlpha(1)

-- 间隔纹理
local splitTexture4 = wowWatcher:CreateTexture(nil, "BACKGROUND")
splitTexture4:SetColorTexture(0.5, 0.5, 0.5, 1)
splitTexture4:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 23, 0); -- 使纹理填充整个框架
splitTexture4:SetSize(1, colorSize);
splitTexture4:SetAlpha(1);

-- 1-5 神圣风暴，绿色为打，红色为不打
local ssfb_wl_green = wowWatcher:CreateTexture(nil, "BACKGROUND")
ssfb_wl_green:SetColorTexture(0, 1, 0, 1)
ssfb_wl_green:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 24, 0); -- 使纹理填充整个框架
ssfb_wl_green:SetSize(colorSize, colorSize);
ssfb_wl_green:SetAlpha(0);

local ssfb_wl_red = wowWatcher:CreateTexture(nil, "BACKGROUND")--创建纹理
ssfb_wl_red:SetColorTexture(1, 0, 0, 1)
ssfb_wl_red:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 24, 0);--设置框架相对锚点
ssfb_wl_red:SetSize(colorSize, colorSize)
ssfb_wl_red:SetAlpha(1)

-- 间隔纹理
local splitTexture5 = wowWatcher:CreateTexture(nil, "BACKGROUND")
splitTexture5:SetColorTexture(0.5, 0.5, 0.5, 1)
splitTexture5:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 29, 0); -- 使纹理填充整个框架
splitTexture5:SetSize(1, colorSize);
splitTexture5:SetAlpha(1);

-- 1-6 奉献，绿色为打，红色为不打
local fx_wl_green = wowWatcher:CreateTexture(nil, "BACKGROUND")
fx_wl_green:SetColorTexture(0, 1, 0, 1)
fx_wl_green:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 30, 0); -- 使纹理填充整个框架
fx_wl_green:SetSize(colorSize, colorSize);
fx_wl_green:SetAlpha(0);

local fx_wl_red = wowWatcher:CreateTexture(nil, "BACKGROUND")--创建纹理
fx_wl_red:SetColorTexture(1, 0, 0, 1)
fx_wl_red:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 30, 0);--设置框架相对锚点
fx_wl_red:SetSize(colorSize, colorSize)
fx_wl_red:SetAlpha(1)

-- 间隔纹理
local splitTexture6 = wowWatcher:CreateTexture(nil, "BACKGROUND")
splitTexture6:SetColorTexture(0.5, 0.5, 0.5, 1)
splitTexture6:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 35, 0); -- 使纹理填充整个框架
splitTexture6:SetSize(1, colorSize);
splitTexture6:SetAlpha(1);

-- 1-7 驱邪术，绿色为打，红色为不打
local qxs_wl_green = wowWatcher:CreateTexture(nil, "BACKGROUND")
qxs_wl_green:SetColorTexture(0, 1, 0, 1)
qxs_wl_green:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 36, 0); -- 使纹理填充整个框架
qxs_wl_green:SetSize(colorSize, colorSize);
qxs_wl_green:SetAlpha(0);

local qxs_wl_red = wowWatcher:CreateTexture(nil, "BACKGROUND")--创建纹理
qxs_wl_red:SetColorTexture(1, 0, 0, 1)
qxs_wl_red:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 36, 0);--设置框架相对锚点
qxs_wl_red:SetSize(colorSize, colorSize)
qxs_wl_red:SetAlpha(1)

-- 间隔纹理
local splitTexture7 = wowWatcher:CreateTexture(nil, "BACKGROUND")
splitTexture7:SetColorTexture(0.5, 0.5, 0.5, 1)
splitTexture7:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 41, 0); -- 使纹理填充整个框架
splitTexture7:SetSize(1, colorSize);
splitTexture7:SetAlpha(1);

-- 1-8 神圣愤怒，绿色为打，红色为不打
local ssfn_wl_green = wowWatcher:CreateTexture(nil, "BACKGROUND")
ssfn_wl_green:SetColorTexture(0, 1, 0, 1)
ssfn_wl_green:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 42, 0); -- 使纹理填充整个框架
ssfn_wl_green:SetSize(colorSize, colorSize);
ssfn_wl_green:SetAlpha(0);

local ssfn_wl_red = wowWatcher:CreateTexture(nil, "BACKGROUND")--创建纹理
ssfn_wl_red:SetColorTexture(1, 0, 0, 1)
ssfn_wl_red:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 42, 0);--设置框架相对锚点
ssfn_wl_red:SetSize(colorSize, colorSize)
ssfn_wl_red:SetAlpha(1)

-- 间隔纹理
local splitTexture8 = wowWatcher:CreateTexture(nil, "BACKGROUND")
splitTexture8:SetColorTexture(0.5, 0.5, 0.5, 1)
splitTexture8:SetPoint("TOPLEFT", wowWatcher, "TOPLEFT", 47, 0); -- 使纹理填充整个框架
splitTexture8:SetSize(1, colorSize);
splitTexture8:SetAlpha(1);

-- 原dragFrame仅用于祝福提示
local dragFrame = CreateFrame("Frame", nil, UIParent)
dragFrame:SetSize(105, 35)  -- 3个图标总宽35 * 3=105
dragFrame:SetPoint("CENTER", healFrame, "CENTER", 0, -150)  -- 位于治疗图标下方

-- 创建水之护盾开关按钮 --
local sgsButton = CreateFrame("Button", nil, UIParent) -- 创建按钮框架
sgsButton:SetSize(30, 30) -- 设置按钮大小
sgsButton:SetPoint("TOP", UIParent, "CENTER", 100, -150) -- 定位到屏幕中心下方
sgsButton:RegisterForClicks("AnyUp") -- 注册接受所有点击事件

-- 创建按钮纹理 --
local shsIcon = sgsButton:CreateTexture(nil, "BACKGROUND") -- 创建纹理对象
shsIcon:SetAllPoints() -- 纹理填满整个按钮
shsIcon:SetTexture("Interface\\Icons\\Spell_Holy_HolyBolt")  -- 替换为圣光术图标
shsIcon:SetAlpha(0.5) -- 初始半透明状态

-- 创建开关状态变量 --
local szhdEnabled = false -- 开关状态变量（默认关闭）
-- 单目标输出的标志，默认为关闭
local oneTarget = false;
-- 智慧审判id
local zhspSpellId = 53408;
-- 愤怒之锤id
local fnzcSpellId = 24239;
-- 十字军打击id
local szjdjSpellId = 35395;
-- 神圣风暴id
local ssfbSpellId = 53385;
-- 奉献id
local fxSpellId = 27173;
-- 驱邪术id
local qxsSpellId = 27138;

-- 点击事件处理 --
sgsButton:SetScript("OnClick", function(self, button)
    szhdEnabled = not szhdEnabled -- 切换开关状态
    PlaySound(szhdEnabled and 856 or 857) -- 播放音效（开启：856，关闭：857）

    -- 更新图标显示状态
    if szhdEnabled then
        shsIcon:SetAlpha(1) -- 完全可见
        shsIcon:SetDesaturated(false) -- 正常颜色
    else
        shsIcon:SetAlpha(0.5) -- 半透明
        shsIcon:SetDesaturated(true) -- 去饱和度（黑白效果）
    end
end)

-- 鼠标提示 --
sgsButton:SetScript("OnEnter", function(self)
    GameTooltip:SetOwner(self, "ANCHOR_RIGHT") -- 设置提示框位置
    GameTooltip:AddLine("圣光术自动施放") -- 标题
    GameTooltip:AddLine("状态：" .. (szhdEnabled and "|cFF00FF00开启|r" or "|cFFFF0000关闭|r"), 1, 1, 1) -- 状态显示
    GameTooltip:AddLine("点击切换开关", 0.6, 0.6, 0.6) -- 操作提示
    GameTooltip:Show() -- 显示提示框
end)

sgsButton:SetScript("OnLeave", function()
    GameTooltip:Hide() -- 隐藏提示框
end)

-- 配置数据 --
local BLESSING_INFO = {
    ["智慧祝福"] = {
        icon = "Interface\\Icons\\Spell_Holy_SealOfWisdom",
        spellIDs = { 19852, 19853, 25894, 25290, 27142, 27143, 48935, 48937 }, -- 普通+强效智慧祝福
        checkFunc = function()
            return GetSpellInfo(19852)  -- 返回基础法术名称
        end
    },
    ["力量祝福"] = {
        icon = "Interface\\Icons\\Spell_Holy_FistOfJustice",
        spellIDs = { 19836, 25782, 25291, 25916, 27140, 27141, 48933, 48931 }, -- 普通+强效力量祝福
        checkFunc = function()
            return GetSpellInfo(19836)
        end
    },
    ["王者祝福"] = {
        icon = "Interface\\Icons\\Spell_Magic_GreaterBlessingofKings",
        spellIDs = { 20217, 25898 }, -- 普通+强效王者祝福
        checkFunc = function()
            return GetSpellInfo(20217)
        end
    }
}

-- 图标池管理 --
local blessingIcons = {}
for i, blessName in ipairs({ "王者祝福", "智慧祝福", "力量祝福" }) do
    local icon = dragFrame:CreateTexture(nil, "OVERLAY")
    icon:SetSize(30, 30)
    icon:SetPoint("LEFT", dragFrame, "LEFT", (i - 1) * 35, 0)
    icon:SetTexture(BLESSING_INFO[blessName].icon)
    icon:Hide()
    blessingIcons[blessName] = icon
end

-- 在文件开头添加战斗状态变量
local inCombat = false
-- 创建战斗状态检测框架
local combatFrame = CreateFrame("Frame")
combatFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
combatFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
combatFrame:SetScript("OnEvent", function(self, event)
    inCombat = (event == "PLAYER_REGEN_DISABLED")

    -- 非战斗时重置所有指示器
    if not inCombat then
        zhsp_wl_red:SetAlpha(1);
        zhsp_wl_green:SetAlpha(0);
        szjdj_wl_red:SetAlpha(1);
        szjdj_wl_green:SetAlpha(0);
        ssfb_wl_red:SetAlpha(1);
        ssfb_wl_green:SetAlpha(0);
        fx_wl_red:SetAlpha(1);
        fx_wl_green:SetAlpha(0);
        qxs_wl_red:SetAlpha(1);
        qxs_wl_green:SetAlpha(0);
    end
end)

-- 判断智慧审判是否可以打
function checkZhsp()
    local zhspCd = false;
    local usable, nomana = IsUsableSpell("智慧审判");
    local start, duration, enabled, modRate = GetSpellCooldown(zhspSpellId);
    if start == 0 or duration == 1.5 then
        zhspCd = true;
    end

    if usable and zhspCd then
        zhsp_wl_red:SetAlpha(0);
        zhsp_wl_green:SetAlpha(1);
    else
        zhsp_wl_red:SetAlpha(1);
        zhsp_wl_green:SetAlpha(0);
    end
end

-- 检测愤怒之锤
function checkFnzc()
    local fnzcCd = false;
    local usable, nomana = IsUsableSpell("愤怒之锤");
    local start, duration, enabled, modRate = GetSpellCooldown(fnzcSpellId);
    if start == 0 or duration == 1.5 then
        fnzcCd = true;
    end
    if usable and fnzcCd then
        fnzc_wl_red:SetAlpha(0);
        fnzc_wl_green:SetAlpha(1);
    else
        fnzc_wl_red:SetAlpha(1);
        fnzc_wl_green:SetAlpha(0);
    end
end

-- 检测十字军打击
function checkSzjdj()
    local szjdjCd = false;
    local usable, nomana = IsUsableSpell("十字军打击");
    local start, duration, enabled, modRate = GetSpellCooldown(szjdjSpellId);
    if start == 0 or duration == 1.5 then
        szjdjCd = true;
    end
    if usable and szjdjCd then
        szjdj_wl_red:SetAlpha(0);
        szjdj_wl_green:SetAlpha(1);
    else
        szjdj_wl_red:SetAlpha(1);
        szjdj_wl_green:SetAlpha(0);
    end
end

-- 改进的祝福检测 --
local function CheckBlessings()
    if not UnitExists("target") or not UnitIsPlayer("target") then
        return {}
    end

    local playerBlessing = false  -- 玩家是否已施加任何祝福
    local appliedBlessings = {}  -- 记录已存在的祝福类型

    -- 第一步：检测所有已应用的祝福
    for i = 1, 40 do
        local name, _, _, _, _, _, source, _, _, spellId = UnitAura("target", i, "HELPFUL")
        if not name then
            break
        end

        -- 检查是否属于任意祝福类型
        for blessType, info in pairs(BLESSING_INFO) do
            if tContains(info.spellIDs, spellId) then
                appliedBlessings[blessType] = true
                if source == "player" then
                    -- 直接判断来源单位
                    playerBlessing = true
                end
            end
        end
    end

    -- 第二步：根据玩家施加状态决定显示逻辑
    if playerBlessing then
        return {}  -- 玩家已施加过任意祝福，不显示任何图标
    else
        -- 仅显示缺失的祝福
        local missing = {}
        for blessType, _ in pairs(BLESSING_INFO) do
            if not appliedBlessings[blessType] then
                table.insert(missing, blessType)
            end
        end
        return missing
    end
end

-- 更新界面逻辑 --
local function UpdateUI()
    -- 隐藏所有祝福图标
    for _, icon in pairs(blessingIcons) do
        icon:Hide()
    end

    -- 检测缺失祝福（原逻辑不变）
    local missing = CheckBlessings()
    if #missing > 0 then
        -- 仅更新祝福图标位置
        for i, blessName in ipairs(missing) do
            local icon = blessingIcons[blessName]
            icon:ClearAllPoints()
            icon:SetPoint("LEFT", dragFrame, "LEFT", (i - 1) * 35, 0)
            icon:Show()
        end
        dragFrame:SetWidth(#missing * 35)
    else
        dragFrame:SetWidth(1)
    end
end

-- 单目标开关
function oneTargetSwitch()
    if oneTarget then
        print("单目标输出关...")
        oneTarget = false;
        one_target_switch_wl_red:SetAlpha(1);
        one_target_switch_wl_green:SetAlpha(0);
    else
        print("单目标输出开...")
        oneTarget = true;
        one_target_switch_wl_red:SetAlpha(0);
        one_target_switch_wl_green:SetAlpha(1);
    end
end

-- 检测神圣风暴
function checkSsfb(inMeleeRange)
    local ssfbCd = false;
    local usable, nomana = IsUsableSpell("神圣风暴");
    local start, duration, enabled, modRate = GetSpellCooldown(ssfbSpellId);
    if start == 0 or duration == 1.5 then
        ssfbCd = true;
    end
    if usable and ssfbCd and inMeleeRange then
        ssfb_wl_red:SetAlpha(0);
        ssfb_wl_green:SetAlpha(1);
    else
        ssfb_wl_red:SetAlpha(1);
        ssfb_wl_green:SetAlpha(0);
    end
end

-- 检测奉献
function checkFx(inMeleeRange)
    local fxCd = false;
    local usable, nomana = IsUsableSpell("奉献");
    local start, duration, enabled, modRate = GetSpellCooldown(fxSpellId);
    if start == 0 or duration == 1.5 then
        fxCd = true;
    end
    if usable and fxCd and inMeleeRange then
        fx_wl_red:SetAlpha(0);
        fx_wl_green:SetAlpha(1);
    else
        fx_wl_red:SetAlpha(1);
        fx_wl_green:SetAlpha(0);
    end
end

-- 检测驱邪术
function checkQxs(playerBuffList)
    local fxCd = false;
    local usable, nomana = IsUsableSpell("驱邪术");
    local start, duration, enabled, modRate = GetSpellCooldown(qxsSpellId);
    if start == 0 or duration == 1.5 then
        fxCd = true;
    end
    -- 检测身上是否有战争艺术的buff
    local hasZzysBuff = false;
    for index, debuffInfo in ipairs(playerBuffList) do
        if debuffInfo.name == "战争艺术" then
            hasZzysBuff = true;
            break ;
        end
    end

    if usable and fxCd and hasZzysBuff then
        qxs_wl_red:SetAlpha(0);
        qxs_wl_green:SetAlpha(1);
    else
        qxs_wl_red:SetAlpha(1);
        qxs_wl_green:SetAlpha(0);
    end
end

-- 检测神圣愤怒
function checkSsfn()
    -- 先判断神圣愤怒这个技能学没学
    local usable, nomana = IsUsableSpell("神圣愤怒");
    if not usable then
        ssfn_wl_red:SetAlpha(1);
        ssfn_wl_green:SetAlpha(0);
    end

    local creatureType = UnitCreatureType("target")
    -- 当前没有目标，就直接返回
    if not creatureType then
        ssfn_wl_red:SetAlpha(1);
        ssfn_wl_green:SetAlpha(0);
    end
    -- 当前目标不是亡灵，也直接返回了
    if not (creatureType and creatureType == '亡灵') then
        ssfn_wl_red:SetAlpha(1);
        ssfn_wl_green:SetAlpha(0);
    end
end

local function getDebuff(player, filter)
    if filter == nil then
        filter = "HARMFUL";
    end
    local debuffList = {}
    --读取对象身上的有害buff
    for i = 1, 40 do
        local name, icon, count, dispelType, duration, expirationTime, source, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossDebuff, castByPlayer = UnitAura(player, i, filter)
        if name then
            table.insert(debuffList, createDebuffInfo(name, count, expirationTime, source, castByPlayer, spellId, canApplyAura));
        else
            break
        end
    end
    return debuffList
end

-- 这段代码是用来创建debuff的对象，保存了名称和过期的时间
function createDebuffInfo(name, count, expirationTime, source, castByPlayer, spellId, canApplyAura)
    return {
        name = name,
        count = count,
        expirationTime = expirationTime,
        source = source,
        castByPlayer = castByPlayer,
        spellId = spellId,
        canApplyAura = canApplyAura
    }
end

-- 事件区
wowWatcher:SetScript("OnUpdate", function()
    local inMeleeRange = (IsSpellInRange("十字军打击", "target") == 1)

    -- 检测当前目标的祝福
    UpdateUI();

    -- 获取我自己身上的debuff
    local playerBuffList = getDebuff("player", "HELPFUL");

    checkZhsp();
    checkFnzc();
    checkSzjdj();
    checkSsfb(inMeleeRange);
    checkFx(inMeleeRange);
    checkQxs(playerBuffList);
    checkSsfn();
end);

